package businessError

import "fmt"

type BusinessError struct {
	Code    int
	Message string
}

func (c *BusinessError) Error() string {
	return fmt.Sprintf("errorCode:%d errMesage:%s", c.Code, c.Message)
}

func NewBusinessError(code int, message string) *BusinessError {
	return &BusinessError{
		Code:    code,
		Message: message,
	}
}

const (
	ERROR_CODE_SYSTEM_ERROR = 1
	ERROR_CODE_NOT_FOUND    = 2

	ERROR_MESSAGE_SYSTEM_ERROR = "SYSTEM ERROR"
	ERROR_MESSAGE_NOT_FOUND    = "NOT FOUND"
)

var (
	SYSTEM_ERROR    = NewBusinessError(ERROR_CODE_SYSTEM_ERROR, ERROR_MESSAGE_SYSTEM_ERROR)
	NOT_FOUND_ERROR = NewBusinessError(ERROR_CODE_NOT_FOUND, ERROR_MESSAGE_NOT_FOUND)
)
